package com.fht.spring_boot_study.model.common.entity;

import org.apache.commons.lang3.StringUtils;

public class SearchBean {
    private int currentPage;
    private int pageSize;
    private String orderBy;
    private String direction;
    private String keyWord;

    public void initSearchBean(){
        this.setCurrentPage(this.getCurrentPage()==0?1:
                this.getCurrentPage());
        this.setPageSize(this.getPageSize()==0?1:
                this.getPageSize());
        this.setOrderBy(StringUtils.isBlank(this.getOrderBy())?"":
                this.getOrderBy());
    }
    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getDirection() {
        return direction;
    }

    public void setDirection(String direction) {
        this.direction = direction;
    }

    public String getKeyWord() {
        return keyWord;
    }

    public void setKeyWord(String keyWord) {
        this.keyWord = keyWord;
    }
}
